package com.example.demo.config;

import com.example.demo.tenant.TenantInterceptor;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class WebConfig {
    @Bean
    public FilterRegistrationBean<TenantInterceptor> tenantFilter() {
        FilterRegistrationBean<TenantInterceptor> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new TenantInterceptor());
        registrationBean.addUrlPatterns("/api/*"); // 配置需要拦截的路径
        return registrationBean;
    }
}
